/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ronin.model;

import com.ronin.model.constant.DurumEnum;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author esimsek
 */
@Entity
@Table(name = "musteri_favori_hizmet")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MusteriFavoriHizmet.findAll", query = "SELECT m FROM MusteriFavoriHizmet m"),
    @NamedQuery(name = "MusteriFavoriHizmet.findById", query = "SELECT m FROM MusteriFavoriHizmet m WHERE m.id = :id"),
    @NamedQuery(name = "MusteriFavoriHizmet.findByMusteriId", query = "SELECT m FROM MusteriFavoriHizmet m WHERE m.musteri.id = :musteriId"),
    @NamedQuery(name = "MusteriFavoriHizmet.findByHizmetId", query = "SELECT m FROM MusteriFavoriHizmet m WHERE m.hizmet.id = :hizmetId"),
    @NamedQuery(name = "MusteriFavoriHizmet.findByDurumId", query = "SELECT m FROM MusteriFavoriHizmet m WHERE m.durum.id = :durumId")})
public class MusteriFavoriHizmet implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @JoinColumn(name = "musteri_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Musteri musteri;
    @JoinColumn(name = "hizmet_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Hizmet hizmet;
    @Enumerated(EnumType.ORDINAL)
    @Column(name = "durum_id")
    private DurumEnum durum;


    public MusteriFavoriHizmet() {
    }

    public MusteriFavoriHizmet(Long id) {
        this.id = id;
    }

    public MusteriFavoriHizmet(Long id, Musteri musteri, Hizmet hizmet, DurumEnum durum) {
        this.id = id;
        this.musteri = musteri;
        this.hizmet = hizmet;
        this.durum = durum;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Musteri getMusteri() {
        return musteri;
    }

    public void setMusteri(Musteri musteri) {
        this.musteri = musteri;
    }

    public Hizmet getHizmet() {
        return hizmet;
    }

    public void setHizmet(Hizmet hizmet) {
        this.hizmet = hizmet;
    }

    public DurumEnum getDurum() {
        return durum;
    }

    public void setDurum(DurumEnum durum) {
        this.durum = durum;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MusteriFavoriHizmet)) {
            return false;
        }
        MusteriFavoriHizmet other = (MusteriFavoriHizmet) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ronin.model.MusteriFavoriHizmet[ id=" + id + " ]";
    }
    
}
